<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message"/>
    
    <rich:panel>
        <f:facet name="header">快餐店列表</f:facet>
        
			<h:outputText value="没有快餐店， 快去录入！！" rendered="#{shops.rowCount==0}"/>
			<h:dataTable styleClass="resultTable" width="100%" id="shops" value="#{shops}" var="shop" rendered="#{shops.rowCount>0}">
				<h:column>
					<f:facet name="header">快餐店名</f:facet>
					<s:link view="/viewSnackShop.xhtml" value="#{shop.name}">
						<f:param name="shopId" value="#{shop.id}" />
					</s:link>
				</h:column>
				<h:column>
					<f:facet name="header">电话</f:facet>
					#{shop.telNo} 
				</h:column>	
				<h:column>
					<f:facet name="header">地址</f:facet>
					#{shop.address} 
				</h:column>								

				<h:column>
					<f:facet name="header"></f:facet>
					<s:link id="viewHotel" value="我要订饭" action="#{dishOrderAction.selectSnackShop(shop)}"/>
				</h:column>
			</h:dataTable>            
    </rich:panel>
	            <div style="clear:both"/>    
    <rich:panel>
        <f:facet name="header">今天你的定饭记录</f:facet>
        
			<h:outputText value="今天没有订餐记录！" rendered="#{dishOrders.rowCount==0}"/>
			<h:dataTable styleClass="resultTable" width="100%" id="orders" value="#{dishOrders}" var="order" rendered="#{dishOrders.rowCount>0}">
				<h:column>
					<f:facet name="header">订饭时间</f:facet>
					<h:outputText value="#{order.createDate}">
					</h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">你点的菜</f:facet>  
					<ui:repeat value="#{orderListAction.getDishesList(order)}" var="dishh">
						<s:link view="/viewDish.xhtml" value="#{dishh.name}">
							<f:param value="#{dishh.id}" name="dishId"/>
						</s:link>
						&#160;&#160;
					</ui:repeat>	
					
				</h:column>	  
				<h:column>
					<f:facet name="header"></f:facet>
					<s:link id="delOrder" value="退订" action="#{orderListAction.delOrder}"/>
				</h:column>
			</h:dataTable>            
    </rich:panel>    
</ui:define>

</ui:composition>

